package com.springboot.service.impl;

import com.springboot.mapper.OrderFormMapper;
import com.springboot.mapper.PatientInfoFormMapper;
import com.springboot.mapper.UserLoginFormMapper;
import com.springboot.model.OrderForm;
import com.springboot.model.PatientInfoForm;
import com.springboot.model.UserLoginForm;
import com.springboot.service.DoctorCheckDiseaseAtPatientListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 医生在患者列表界面查看该患者此次预约的病情详情
 */
@Service
public class DoctorCheckDiseaseAtPatientListServiceImpl implements DoctorCheckDiseaseAtPatientListService {
    @Autowired
    private UserLoginFormMapper userLoginFormMapper;

    @Autowired
    private OrderFormMapper orderFormMapper;

    @Autowired
    private PatientInfoFormMapper patientInfoFormMapper;

    //通过手机号码查找用户
    @Override
    public UserLoginForm findUserByTel(String tel)
    {
        UserLoginForm userLoginForm=userLoginFormMapper.selectByTel(tel);
        return userLoginForm;
    }

    //通过四个外键：医生id 患者id 预约日期 预约时间查找预约记录
    @Override
    public OrderForm findBookIdByOrder(OrderForm orderForm)
    {
        OrderForm order=orderFormMapper.selectByForeignKey2(orderForm);
        return order;
    }

    //通过bookId查找病情记录
    @Override
    public PatientInfoForm findPatientInfoByBookId(Integer bookId)
    {
        PatientInfoForm patientInfoForm=patientInfoFormMapper.selectByPrimaryKey(bookId);
        return patientInfoForm;
    }
}
